import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';

const routes: RouteRecordRaw[] = [
	{
		path: '/',
		component: () => import('@/views/layout/index.vue'),
		children: [
			{
				path: '',
				name: 'Home',
				component: () => import('@/views/Home.vue'),
			},
			{
				path: 'techArticle',
				name: 'TechArticle',
				component: () => import('@/views/article/TechArticle.vue'),
				children: [
					{
						path: ':id', // 动态路由参数 :id
						name: 'ArticleDetail',
						component: () => import('@/views/article/ArticleDetail.vue'), // 文章详情组件
					},
				],
			},
			{
				path: 'life', // 动态路由参数 :id
				name: 'life',
				component: () => import('@/views/life/index.vue'), // 文章详情组件
			},
		],
	},
	{
		path: '/manager',
		name: 'Manager',
		component: () => import('@/views/manager/Platform.vue'),
		children: [
			{
				path: '',
				name: 'Basic',
				component: () => import('@/views/manager/Basic.vue'),
			},
			{
				path: 'sql',
				name: 'Sql',
				component: () => import('@/views/manager/Sql.vue'),
			},
			{
				path: 'webUri',
				name: 'WebUri',
				component: () => import('@/views/manager/WebUri.vue'),
			},
			{
				path: 'health',
				name: 'Health',
				component: () => import('@/views/manager/Health.vue'),
			},
			{
				path: 'article',
				name: 'Article',
				component: () => import('@/views/manager/Article.vue'),
			},
			{
				path: 'draft',
				name: 'Draft',
				component: () => import('@/views/manager/Draft.vue'),
			},
			{
				path: 'life',
				name: 'Life',
				component: () => import('@/views/manager/Life.vue'),
			},
			{
				path: 'mark',
				name: 'Mark',
				component: () => import('@/views/manager/Mark.vue'),
			},
			{
				path: 'link',
				name: 'Link',
				component: () => import('@/views/manager/Link.vue'),
			},
		],
	},
	{
		path: '/:pathMatch(.*)*',
		name: 'NotFound',
		component: () => import('@/views/NotFound.vue'),
	},
];

const router = createRouter({
	history: createWebHistory(),
	routes,
});

export default router;
